package net.keebook.webapp.entity;

import java.io.Serializable;

import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

import net.keebook.webapp.util.ExposableId;

@Entity
@Cacheable
public class User implements Serializable, ExposableId {
	private static final long serialVersionUID = -8265399770669571076L;
	
	public enum LoginMethod {
		PASSWORD, OPENID, OAUTH
	};
	
	@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
	private Long id;
	@Enumerated(EnumType.STRING)
	private LoginMethod loginMethod = LoginMethod.PASSWORD;
	private String username = "";
	private String hashedPassword = "";
	private Boolean admin = false;
	@Column(unique=true)
	private String exposableId;
	private String name = "";
	private String email = "";
	private String timezone = "";
	private String oauthId = "";
	private String country = "US";
	private String language = "en";
	private Boolean confirmed = false;
	private Boolean enabled = true;
	private Boolean groupItems = true;
	private Boolean termsAccepted = false;
	@ManyToOne
	private GeneratorPreferences generatorPreferences;
	
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getHashedPassword() {
		return hashedPassword;
	}
	public void setHashedPassword(String hashedPassword) {
		this.hashedPassword = hashedPassword;
	}
	public Boolean getAdmin() {
		return admin;
	}
	public void setAdmin(Boolean admin) {
		this.admin = admin;
	}
	public GeneratorPreferences getGeneratorPreferences() {
		return generatorPreferences;
	}
	public void setGeneratorPreferences(GeneratorPreferences generatorPreferences) {
		this.generatorPreferences = generatorPreferences;
	}
	public String getExposableId() {
		return exposableId;
	}
	public void setExposableId(String exposableId) {
		this.exposableId = exposableId;
	}
	public String getTimezone() {
		return timezone;
	}
	public void setTimezone(String timezone) {
		this.timezone = timezone;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public Boolean getConfirmed() {
		return confirmed;
	}
	public void setConfirmed(Boolean confirmed) {
		this.confirmed = confirmed;
	}
	public Boolean getEnabled() {
		return enabled;
	}
	public void setEnabled(Boolean enabled) {
		this.enabled = enabled;
	}
	public LoginMethod getLoginMethod() {
		return loginMethod;
	}
	public void setLoginMethod(LoginMethod loginMethod) {
		this.loginMethod = loginMethod;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getOauthId() {
		return oauthId;
	}
	public void setOauthId(String oauthId) {
		this.oauthId = oauthId;
	}
	public Boolean getGroupItems() {
		return groupItems;
	}
	public void setGroupItems(Boolean groupItems) {
		this.groupItems = groupItems;
	}
	public String getCountry() {
		return country;
	}
	public void setCountry(String country) {
		this.country = country;
	}
	public String getLanguage() {
		return language;
	}
	public void setLanguage(String language) {
		this.language = language;
	}
	public Boolean getTermsAccepted() {
		return termsAccepted;
	}
	public void setTermsAccepted(Boolean termsAccepted) {
		this.termsAccepted = termsAccepted;
	}
}
